home *** CD-ROM | disk | FTP | other *** search
-
-
-
- TTTTiiiieeee::::::::HHHHaaaasssshhhh((((3333)))) TTTTiiiieeee::::::::HHHHaaaasssshhhh((((3333))))
-
-
-
- NNNNAAAAMMMMEEEE
- Tie::Hash, Tie::StdHash - base class definitions for tied hashes
-
- SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- package NewHash;
- require Tie::Hash;
-
- @ISA = (Tie::Hash);
-
- sub DELETE { ... } # Provides needed method
- sub CLEAR { ... } # Overrides inherited method
-
-
- package NewStdHash;
- require Tie::Hash;
-
- @ISA = (Tie::StdHash);
-
- # All methods provided by default, define only those needing overrides
- sub DELETE { ... }
-
-
- package main;
-
- tie %new_hash, 'NewHash';
- tie %new_std_hash, 'NewStdHash';
-
-
- DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- This module provides some skeletal methods for hash-tying classes. See
- the _p_e_r_l_t_i_e manpage for a list of the functions required in order to tie
- a hash to a package. The basic TTTTiiiieeee::::::::HHHHaaaasssshhhh package provides a new method,
- as well as methods TIEHASH, EXISTS and CLEAR. The TTTTiiiieeee::::::::SSSSttttddddHHHHaaaasssshhhh package
- provides most methods required for hashes in the _p_e_r_l_t_i_e manpage. It
- inherits from TTTTiiiieeee::::::::HHHHaaaasssshhhh, and causes tied hashes to behave exactly like
- standard hashes, allowing for selective overloading of methods. The new
- method is provided as grandfathering in the case a class forgets to
- include a TIEHASH method.
-
- For developers wishing to write their own tied hashes, the required
- methods are briefly defined below. See the the _p_e_r_l_t_i_e manpage section
- for more detailed descriptive, as well as example code:
-
- TIEHASH classname, LIST
- The method invoked by the command tie %hash, classname. Associates a
- new hash instance with the specified class. LIST would represent
- additional arguments (along the lines of the _A_n_y_D_B_M__F_i_l_e manpage and
- compatriots) needed to complete the association.
-
- STORE this, key, value
- Store datum _v_a_l_u_e into _k_e_y for the tied hash _t_h_i_s.
-
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- TTTTiiiieeee::::::::HHHHaaaasssshhhh((((3333)))) TTTTiiiieeee::::::::HHHHaaaasssshhhh((((3333))))
-
-
-
- FETCH this, key
- Retrieve the datum in _k_e_y for the tied hash _t_h_i_s.
-
- FIRSTKEY this
- Return the (key, value) pair for the first key in the hash.
-
- NEXTKEY this, lastkey
- Return the next (key, value) pair for the hash.
-
- EXISTS this, key
- Verify that _k_e_y exists with the tied hash _t_h_i_s.
-
- DELETE this, key
- Delete the key _k_e_y from the tied hash _t_h_i_s.
-
- CLEAR this
- Clear all values from the tied hash _t_h_i_s.
-
- CCCCAAAAVVVVEEEEAAAATTTTSSSS
- The the _p_e_r_l_t_i_e manpage documentation includes a method called DESTROY as
- a necessary method for tied hashes. Neither TTTTiiiieeee::::::::HHHHaaaasssshhhh nor TTTTiiiieeee::::::::SSSSttttddddHHHHaaaasssshhhh
- define a default for this method. This is a standard for class packages,
- but may be omitted in favor of a simple default.
-
- MMMMOOOORRRREEEE IIIINNNNFFFFOOOORRRRMMMMAAAATTTTIIIIOOOONNNN
- The packages relating to various DBM-related implemetations (_D_B__F_i_l_e,
- _N_D_B_M__F_i_l_e, etc.) show examples of general tied hashes, as does the the
- _C_o_n_f_i_g manpage module. While these do not utilize TTTTiiiieeee::::::::HHHHaaaasssshhhh, they serve
- as good working examples.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-